package com.cby.jetpack.sample.binding

import android.os.Bundle
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity
import com.cby.jetpack.sample.databinding.ActivityViewBindTestBinding

/**
 * @description: TestViewBindActivity
 *
 * @author ChenBaoyang
 * @date 8/9/21 11:31
 */
class TestViewBindActivity : AppCompatActivity() {

    private lateinit var binding: ActivityViewBindTestBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityViewBindTestBinding.inflate(LayoutInflater.from(this@TestViewBindActivity))
        setContentView(binding.root)
        initEvent()
    }

    /**
     * 初始化事件
     */
    private fun initEvent() {
        binding.btnTest1.setOnClickListener {
            binding.tvTest1.text = binding.btnTest1.text
        }

        binding.btnTest2.setOnClickListener {
            binding.tvTest1.text = binding.btnTest2.text
        }
    }
}